package com.leetcode.p200;

import com.utils.DataUtils;

public class Test242 {

    public boolean isAnagram(String s, String t) {
        int[] sArray = new int[26];
        int[] tArray = new int[26];

        for (char sChar : s.toCharArray()) {
            sArray[sChar - 'a']++;
        }

        for (char sChar : t.toCharArray()) {
            tArray[sChar - 'a']++;
        }

        for (int i = 0; i < 26; i++) {
            if (sArray[i] != tArray[i]) {
                return false;
            }
        }

        return true;
    }

    public static void main(String[] args) {
        Test242 test = new Test242();
        System.out.println(test.isAnagram("anagram", "nagaram"));
    }
}
